

class Consumer:
    def __init__(self,product,price):
        self.name = "消费者"
        self.product = product
        self.price = price
    def shopping(self,name):
        print("向{} 购买 {}价格内的 {}产品".format(name,self.price,self.product))


class Producer:
    def __init__(self,product,price):
        self.name="生产商"
        self.product = product
        self.price = price
    def sale(self,name):
        print("向{} 销售 {}价格的 {}产品".format(name,self.price,self.product))

class Mediator:
    def __init__(self):
        self.name = "中介"
        self.consume = None
        self.producer = None
    def sale(self):
        self.consume.shopping(self.producer.name)
    def shopping(self):
        self.producer.sale(self.consume.name)
    def profit(self):
        print('中介净赚：{}'.format(self.consume.price-self.producer.price))
    def complete(self):
        self.sale()
        self.shopping()
        self.profit()

consumer = Consumer("shouji",3000)
producer = Producer("shouji",2000)
mediator =Mediator()
mediator.consume = consumer
mediator.producer = producer
mediator.complete()